package book.crypto;

import java.math.BigInteger;
import java.security.NoSuchAlgorithmException;

import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;

/**
 * 用于对称加密、有些签名算法的密钥生成
 * @author apple
 *
 */
public class KeyGeneratorTest {

	public static void main(String[] args) throws NoSuchAlgorithmException {
		
		KeyGenerator gen = KeyGenerator.getInstance("des");
		SecretKey key = gen.generateKey();
		System.out.println(new BigInteger(key.getEncoded()));
	}
}
